﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.Ooohd.Bll.Img;
public partial class Album_album_list : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ToolBar.AddBtn("刷新", new EventHandler(reflesh));
        ToolBar.AddBtn("删除", new EventHandler(del));
        ToolBar.AddBtn("添加", new EventHandler(add));
        ToolBar.AspNetPager.PageChanged+=new EventHandler(AspNetPager_PageChanged);
        if (IsPostBack) return;
        BindDate("");
    }

    private void BindDate(string sql, params object[] param)
    {
        var bl = new ZS_Album();
        int rc = 0;
        Repeater1.DataSource = bl.Query(sql, "id desc",(ToolBar.AspNetPager.CurrentPageIndex-1)*ToolBar.AspNetPager.PageSize,ToolBar.AspNetPager.PageSize,ref rc, param);
        Repeater1.DataBind();
        ToolBar.AspNetPager.RecordCount = rc;
        ViewState["sql"] = sql;
        ViewState["param"] = param;
        
    }
    private void AspNetPager_PageChanged(object sender, EventArgs e) {
        BindDate(ViewState["sql"].ToString(),(object[])ViewState["param"]);
    }

    private void add(object sender, EventArgs e) { 
        
    }

    private void edit(object sender, EventArgs e)
    {

    }

    private void del(object sender, EventArgs e)
    {

    }

    private void reflesh(object sender, EventArgs e)
    {
        Response.Redirect("album_list.aspx");
    }
}
